package locations.actions;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import locations.dao.DAOFactory;
import locations.dao.PacientDAO;
import locations.model.Pacient;
import locations.util.DistanceToCoordMap;

import com.opensymphony.xwork2.ActionSupport;

public class NewSearchAction  extends ActionSupport{

	private static final long serialVersionUID = 1L;
	
	private String pageTitle = "Busqueda";
	private List<Pacient> pacients = new ArrayList();
	private Map<Double, String> map;
	
	public String execute(){
		map =  DistanceToCoordMap.getMap();
		PacientDAO dao = DAOFactory.getPacientDAO();
		this.setPacients(dao.retrieveAll());
                if (this.getPacients().isEmpty())
                {
                    return "ERROR";
                }
		return SUCCESS;
	}

	public List<Pacient> getPacients() {
		return pacients;
	}

	public void setPacients(List<Pacient> pacients) {
		this.pacients = pacients;
	}

	public Map<Double, String> getMap() {
		return map;
	}

	public void setMap(Map<Double, String> map) {
		this.map = map;
	}
	
	

}

